package com.cl.pile.rule.filter;

import org.apache.commons.lang3.StringUtils;

/**
 * @author chenyitao
 * @date 2021/3/4
 */
public class DateGtFilterOperation extends BaseDateOperation implements IFilterOperation {


    @Override
    public boolean filterMatch(Object value, String matchValue) {
        if (StringUtils.isBlank(String.valueOf(value)) || StringUtils.isBlank(matchValue)) {
            return false;
        }
        try {
            String date1Str = String.valueOf(value);
            if (date1Str.length() < 10) {
                return false;
            }
            String date1 = date1Str.substring(0, 10).replace("-","").replace("/","");
            String date2 = matchValue.replace("-","").replace("/","");
            return Long.parseLong(date1) > Long.parseLong(date2);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    @Override
    public String filterName() {
        return "日期大于";
    }
}
